package top.lingma.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.integration.redis.util.RedisLockRegistry;
import org.springframework.integration.support.locks.LockRegistry;

/**
 * @author yui
 * @date 2019年05月21日 上午11:57
 */
@Configuration
public class LockRegistryConfig {
    @Bean
    @Qualifier("limitLockRegistry")
    LockRegistry userTradeLockRegistry(RedisConnectionFactory connectionFactory) {
        LockRegistry registry = new RedisLockRegistry(connectionFactory, "limit:lock:", 6000);
        return registry;
    }
}
